﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace WebApplication11.Models
{
    public class DB
    {
        private static int BookCounter = 4;
        public static List<Books> Books
        {
            get
            {
                return _Books;
            }
            set
            {
                _Books = value;
            }
        }

        private static List<Books> _Books = new List<Books>()
        {
            new Books(){
                Title = "On The Road",
                ImgUrl = "http://41.media.tumblr.com/7446d71df45359975d3f1bd9aa8fee96/tumblr_mlkrb2fH9q1rn2fvxo1_1280.jpg",
                Author = "Jack Kerouac",
                Genre = "Literature",
                PubDate = new DateTime(1957, 9, 5),
                Rating = Rating.five_stars,
                Summary = "The two main characters of the book are the narrator, Sal Paradise, and his friend Dean Moriarty, much admired for his carefree attitude and sense of adventure, a free-spirited maverick eager to explore all kicks and an inspiration and catalyst for Sal's travels. The novel contains five parts, three of them describing road trips with Moriarty. The narrative takes place in the years 1947 to 1950, is full of Americana, and marks a specific era in jazz history, somewhere between its Charlie Parker Ornithology period and another period that began with Miles Davis. The novel is largely autobiographical, Sal being the alter ego of the author and Dean standing for Neal Cassady. The epic nature of the adventures and the text itself creates a tremendous sense of meaning and purpose for the themes and lessons",
                Id = 697812453265
            },

           new Books(){
                Title = "Ulysses",
                ImgUrl = "https://upload.wikimedia.org/wikipedia/commons/c/c0/UlyssesCover.jpg",
                Author = "James Joyuce",
                Genre = "Literature",
                PubDate = new DateTime(1922, 2, 2),
                Rating = Rating.four_stars,
                Summary = "Joyce divided Ulysses into 18 chapters or episodes. At first glance much of the book may appear unstructured and chaotic; Joyce once said that he had put in so many enigmas and puzzles that it will keep the professors busy for centuries arguing over what I meant, which would earn the novel immortality.[13] The two schemata which Stuart Gilbert and Herbert Gorman released after publication to defend Joyce from the obscenity accusations made the links to the Odyssey clear, and also explained the work's internal structure.Every episode of Ulysses has a theme, technique, and correspondence between its characters and those of the Odyssey. The original text did not include these episode titles and the correspondences; instead, they originate from the Linati and Gilbert schemata. Joyce referred to the episodes by their Homeric titles in his letters. He took the idiosyncratic rendering of some of the titles, e.g. Nausikaa and the Telemachia. from Victor Bérard's two-volume Les Phéniciens et l'Odyssée which he consulted in 1918 in the Zentralbibliothek Zürich.",
                Id = 7654231
           },

           new Books(){
                Title = "Dune",
                ImgUrl = "https://upload.wikimedia.org/wikipedia/en/5/5a/FrankHerbert_Dune_1st.jpg",
                Author = "Frank Herbert",
                Genre = "Sci-Fi",
                PubDate = new DateTime(1965, 10, 1),
                Rating = Rating.three_stars,
                Summary = "Set in the distant future amidst a feudal interstellar society in which noble houses, in control of individual planets, owe allegiance to the Padishah Emperor, Dune tells the story of young Paul Atreides, whose noble family accepts the stewardship of the desert planet Arrakis. As this planet is the only source of the spice melange, the most important and valuable substance in the universe, control of Arrakis is a coveted — and dangerous — undertaking. The story explores the multi-layered interactions of politics, religion, ecology, technology, and human emotion, as the forces of the empire confront each other in a struggle for the control of Arrakis and its spice.",
                Id = 562387
            }
            };

        //public static void NextBook(Books NewBook)
        //{
        //    NewBook.Id = BookCounter;
        //    BookCounter += 1;
        //    _Books.Add(NewBook);
        //}
        public static bool CreateBook(Books book)
        {
            if (_Books.Any(x => x.Id == book.Id)) return false;
            _Books.Add(book);
            return true;
        }
    }
}